package dnbW.utilW;

import java.util.Collection;

/**
 * Contains a list of static methods to assist string processing
 * @author Truong Ba Quan
 */
public class StringUtilities {
    /**
     * Produces a concatenation of strings in the input with comma "," between them
     * @param stringList    List of strings
     * @return              The concatenation
     */
    public static String getCommaConcatenation(Collection<String> stringList) {
        StringBuilder builder = new StringBuilder();
        boolean first = true;
        for (String value : stringList) {
            if (first) {
                builder.append(value);
                first = false;
            }
            else builder.append(", " + value);
        }
        return builder.toString();
    }
}
